package com.caikun.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Servlet implementation class LoginStatuController
 */
public class LoginStatuController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//		String acc = request.getParameter("account");
		String bind = request.getParameter("bind");
		PrintWriter out = response.getWriter();
		String tel = (String)request.getSession().getAttribute("bind");
		System.out.println(tel);

		if(tel!=null){
			out.write("{\"status\":\"666\",\"bind\":"+tel+"}");
		}
		else{
			out.write("{\"status\":\"444\"}");
		}
		out.flush();
		out.close();
	}
}
